function makeEl( el ) { return $(document.createElement(el)); }

function getCurrentDateTime() {

    var dateTimeString = new StringBuffer();

    var currentDate = new Date()

    dateTimeString.append( currentDate.getDate() );
    var minutes = currentDate.getMinutes();
    if( minutes < 10 ) { minutes = "0" + minutes; }

    return currentDate.getDate() + "/" + (currentDate.getMonth()+1) + "/" + currentDate.getFullYear() + " " + currentDate.getHours() + ":" + minutes;
}

function StringBuffer() { 
   this.buffer = []; 
} 

StringBuffer.prototype.append = function append(string) { 
    this.buffer.push(string); 
    return this; 
}; 

StringBuffer.prototype.toString = function toString() { 
    return this.buffer.join(""); 
};

function addShadowboxKeyPressHandlers() {

    $(document).bind('keydown', shadowboxKeyPress );

}

function shadowboxKeyPress( e ) {
    if(e.keyCode==27 && Shadowbox ) { Shadowbox.close(); }
    if(e.keyCode==13 && Shadowbox ) { $('#shadowboxSubmitButton').click(); }
}

function closeShadowbox() { Shadowbox.close(); }

// taken from the internet to determine the width of the browser scrollbar
function getScrollBarWidth() {
    var div = $('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div>');
    // Append our div, do our calculation and then remove it
    $('body').append(div);
    var w1 = $('div', div).innerWidth();
    div.css('overflow-y', 'scroll');
    var w2 = $('div', div).innerWidth();
    $(div).remove();
    return (w1 - w2);
}
